<?php
namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class UserBuilderModel extends Model {
    use SoftDeletes;

    protected $table = 'user_builder';

    /**lastBuilder
     * 最后一条评测
     */
    public function foods() {
        return $this->hasMany(UserFoodModel::class, 'user_builder_id', 'id')->orderBy('updated_at');
    }

    /**用户
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user() {
        return $this->belongsTo(BmrUserModel::class, 'bmr_user_id', 'id');
    }
}